/**
 * @(#)Student.java
 *
 * Copyright: Copyright (c) 2003 Carnegie Mellon University
 *
 * This program is the implementation of the original system in the Assignment 2 of "Architectures
 * of Software Systems" class. For the details of each classes, please refer to the provided javadoc
 * documents. You will also find some useful information such as implementation decisions, coding
 * standards, and naming conventions in the README file.
 *
 * History:
 *
 * Date          Author              Change
 * ----------    ----------------    ---------------------------------------------------------------
 * 07/15/2003    Jung Soo Kim        Initial version.
 */


import java.io.Serializable;
import java.util.ArrayList;
import java.util.StringTokenizer;


/**
 * This class represents a record of a student. This class contains a student's personal information
 * and the course numbers the student has completed. This class is constructed from a field-oriented
 * and space-separated string. For the detailed format of such a string refer to 
 * {@link #Student(String)}. This class implements <code>Serializable</code> so that instances of
 * this class can be passed between machines through RMI.
 *
 * @author Jung Soo Kim
 * @version 1.0
 */
public class SIDPwd implements Serializable {

    /**
     * A string representing this student's ID.
     */
    protected String sSID;

    /**
     * A string representing this student's last name.
     */
    protected String sPWD;

 
    public SIDPwd(String sInput)
    {
        // Prepare to tokenize the input string.
        StringTokenizer objTokenizer = new StringTokenizer(sInput);

        // Get this student's ID, name, and program.
        this.sSID     = objTokenizer.nextToken();
        this.sPWD    = objTokenizer.nextToken();
     }

    /**
      * Test if the given string <code>sSID</code> is equal to the ID of this student record.
      *
      * @param  sSID a string representing a student ID
      * @return <code>true</code> if <code>sSID</code> is equal to the ID of this student record
      * @see    #match(String,String)
      */
    public boolean match(String sSID) {
        return this.sSID.equals(sSID);
    }

    /**
     * Return the name of this student record.
     *
     * @return the first and last name of this student record
     */
    public String getPWD() {
        return this.sPWD;
    }

  
    public String toString() {
        // Create a string to return using ID, name, and program.
        String sReturn = this.sSID + " " + this.sPWD;

        return sReturn;
    }
}
